package com.allwees.bs.core.modelbase.branch;

/**
 *
 *
 * @author yangylsky
 * @since 2019-09-23
 *
 */
public class BranchUserContext {

    private static ThreadLocal<BranchUser> userThreadLocal = new ThreadLocal<>();

    public static BranchUser getUser() {
        return userThreadLocal.get();
    }

    public static void setUser(BranchUser user) {
        userThreadLocal.set(user);
    }

    public static void unsetUser(){
        userThreadLocal.remove();
    }

    public static String getBranchUuid() {
    	BranchUser user = userThreadLocal.get();
        return user == null ? null : user.getBranchUuid();
    }
}
